package com.realone.packman.codec.decoder;

import com.realone.packman.codec.decoder.vo.BmsDecoderDataVoOperationOk;
import com.realone.packman.codec.exception.BmsDecoderException;

import java.nio.ByteBuffer;

/**
 * 设置BMS放电参数 解码
 *
 * @author hugx
 * @create 2018-09-14 14:31
 */
public class BmsDecoder16 extends BmsDecoder<BmsDecoderDataVoOperationOk> implements BmsDecoderStrategy {

    public BmsDecoder16(Integer classType) {
        this.classType = classType;
    }

    @Override
    public BmsDecoderDataVoOperationOk decoderBody(ByteBuffer bb) {
        if (bb == null) {
            throw new BmsDecoderException(new NullPointerException());
        }

        BmsDecoderDataVoOperationOk result = new BmsDecoderDataVoOperationOk(this.classType);
        result.setOperationOk(bb.get());

        return result;
    }


}
